import UIKit
import Flutter
import AppTrackingTransparency
import umeng_push_sdk
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
      SwiftChannelPlugin.register(with: self.registrar(forPlugin: SwiftChannelPlugin.channelName)!)
      GeneratedPluginRegistrant.register(with: self)
      _ = TPNoti()
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
    private func trackingPrivacy() {
        if UserDefaults.standard.bool(forKey: "iiii_first") {
            UserDefaults.standard.set(true, forKey: "iiii_first")
            return
        }
        if #available(iOS 14.5, *) {
            ATTrackingManager.requestTrackingAuthorization { (status) in
                switch status {
                case .denied:
                    debugPrint("用户拒绝")
                    break
                case .authorized:
                    debugPrint("用户允许")
                    break
                case .notDetermined:
                    debugPrint("用户没有选择")
                default:
                    break
                }
            }
        } else {
            
        }
    }
    
    override func applicationDidBecomeActive(_ application: UIApplication) {
        trackingPrivacy()
    }
}

